package com.sairobo.base.modules.sys.service.impl;

import com.sairobo.base.common.entity.Page;
import com.sairobo.base.common.entity.Query;
import com.sairobo.base.common.entity.R;
import com.sairobo.base.common.service.CommonService;
import com.sairobo.base.common.utils.CommonUtils;
import com.sairobo.base.modules.sys.entity.SysOss;
import com.sairobo.base.modules.sys.manager.SysOssManager;
import com.sairobo.base.modules.sys.service.SysOssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 文件上传
 *
 * @author admin
 * @email sairobo
 * @url www.sairobo.com
 * @date 2018年1月17日 下午7:58:51
 */
@Service("sysOssService")
public class SysOssServiceImpl extends CommonService implements SysOssService {

	@Autowired
	private SysOssManager sysOssManager;

	@Override
	public Page<SysOss> listSysOss(Map<String, Object> params) {
		Query query = new Query(params);
		Page<SysOss> page = new Page<>(query);
		sysOssManager.listSysOss(page, query);
		return page;
	}

	@Override
	public R saveSysOss(SysOss role) {
		int count = sysOssManager.saveSysOss(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getSysOssById(Long id) {
		SysOss sysOss = sysOssManager.getSysOssById(id);
		return CommonUtils.msg(sysOss);
	}

	@Override
	public R updateSysOss(SysOss sysOss) {
		int count = sysOssManager.updateSysOss(sysOss);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(Long[] id) {
		int count = sysOssManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
